package cn.fanqinghong.ymcc.feignClient;

import cn.fanqinghong.ymcc.domain.User;
import cn.fanqinghong.ymcc.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * FAN
 * 2022/7/18  17:29
 */
@Component
public class UserFallbackFactory implements FallbackFactory {
    @Override
    public Object create(Throwable throwable) {
        return new UserFeignClient() {
            @Override
            public JSONResult get(Long id) {
                return JSONResult.error("查询错误，请稍后再试","4208");
            }

            @Override
            public JSONResult saveOrUpdate(User user) {
                return JSONResult.error("查询错误，请稍后再试","4208");
            }

            @Override
            public JSONResult list() {
                return JSONResult.error("查询错误，请稍后再试","4208");
            }
        };
    }
}
